﻿namespace Vdc.Grid
{
    using Vdc.Grid.Design;
    using System;
    using System.ComponentModel;

    [TypeConverter(typeof(GridMasterDetailSettingsConverter))]
    public class GridMasterDetailSettings : GridPersistentObject
    {
        [Bindable(true), Category("Master/Detail"), DefaultValue(""), NotifyParentProperty(true), Description("Gets or sets a value indicating the name of the column that stores the number of records for the detail grids.")]
        public string DetailsCountField
        {
            get
            {
                object obj2 = base.ViewState["DetailsCountField"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                base.ViewState["DetailsCountField"] = value;
            }
        }

        [Bindable(true), Category("Master/Detail"), DefaultValue(1), NotifyParentProperty(true), Description("The loading mode used to load the detail grids.")]
        public DetailGridLoadingMode LoadingMode
        {
            get
            {
                object obj2 = base.ViewState["LoadingMode"];
                if (obj2 != null)
                {
                    return (DetailGridLoadingMode) obj2;
                }
                return DetailGridLoadingMode.OnCallback;
            }
            set
            {
                base.ViewState["LoadingMode"] = value;
            }
        }

        [Description("If set to false, the detail grids that don't contain any records won't be displayed."), NotifyParentProperty(true), DefaultValue(false), Bindable(true), Category("Master/Detail")]
        public bool ShowEmptyDetails
        {
            get
            {
                object obj2 = base.ViewState["ShowEmptyDetails"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                base.ViewState["ShowEmptyDetails"] = value;
            }
        }

        [DefaultValue(1), NotifyParentProperty(true), Bindable(true), Description("The initial state for the detail grids."), Category("Master/Detail")]
        public DetailGridState State
        {
            get
            {
                object obj2 = base.ViewState["State"];
                if (obj2 != null)
                {
                    return (DetailGridState) obj2;
                }
                return DetailGridState.Collapsed;
            }
            set
            {
                base.ViewState["State"] = value;
            }
        }
    }
}

